$execute unless items entity @s $(slot) * run return fail
summon item ~ ~ ~ {Item:{id:"poisonous_potato"},Tags:[util.tempItemEntity]}
$data modify entity @n[tag=util.tempItemEntity] Item set from entity @s Inventory[{Slot:$(slot_byte)b}]
data modify entity @n[tag=util.tempItemEntity] Owner set from entity @s UUID

tag @n[tag=util.tempItemEntity] remove util.tempItemEntity
$item replace entity @s $(slot) with air